package com.example.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class NacosFallback implements FallbackFactory<NacosService> {

    @Override
    public NacosService create(Throwable cause) {
        return new NacosService() {
            @Override
            public String provider(String username, Integer age) {
                return "provider微服务=>名字"+username+"年龄"+age+"发生错误";
            }

            @Override
            public String teachers() {
                System.out.println(cause);
                log.info(cause.toString());
                return "教师查询远程调用发生错误";
            }
        };
    }
}
